package com.bdqn.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller

public class HelloProject {

    @GetMapping ("/show")
    public String show(@RequestParam(value = "resName") String userName, Model model, HttpServletRequest request){
        System.out.println("resName-->" + userName);
        String userName1 = request.getParameter("resName");
        System.out.println("再次确实：resName-->" + userName1);
        model.addAttribute("resName",userName);
        return "show";
    }
    @RequestMapping("/hello")
    public String hello(){
        return "hello";
    }

    @RequestMapping("/hi1")
    public String hi1(@RequestParam(value = "realName",required = false) String realName,Model model){
        realName = "男";
        model.addAttribute("realName",realName);
        return "hi1";
    }
}
